home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6306 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: news.th-darmstadt.de!news
  2. From: Enno Sandner <enno@intellektik.informatik.th-darmstadt.de>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Nested Template Classes
  5. Date: Thu, 08 Feb 1996 09:50:20 +0100
  6. Organization: Fachbereich Informatik, TH Darmstadt
  7. Message-ID: <3119B94C.167EB0E7@intellektik.informatik.th-darmstadt.de>
  8. References: <4f6kql$70s@charnel.ecst.csuchico.edu: <ENNO.96Feb6180259@kitz.inferenzsysteme.informatik.th-darmstadt.de: <4f9nsa$ksj@charnel.ecst.csuchico.edu>
  9. NNTP-Posting-Host: kitz.intellektik.informatik.th-darmstadt.de
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b6a (X11; I; SunOS 4.1.3 sun4m)
  14.  
  15. James Robert McElroy wrote:
  16. > In article <ENNO.96Feb6180259@kitz.inferenzsysteme.informatik.th-darmstadt.de:,
  17. > Enno Sandner <enno@inferenzsysteme.informatik.th-darmstadt.de: wrote:
  18. > :In article <4f6kql$70s@charnel.ecst.csuchico.edu: mcelroy@ecst.csuchico.edu (James Robert McElroy) writes:
  19. > :
  20. > :
  21. > :The 2nd solution is correct.
  22. > :
  23. > :       Enno
  24. > Really?!  Hmmm...  Borland 3.1 can't handle it.  HP-UX does!  G++
  25. > doesn't like it either.  Is there a spec anywhere telling how to
  26. > handle this situation, (ANSI C++) or is it still undefined?
  27. >
  28.  
  29. If you define a member-function outside its class-definition
  30. the function-name has to be qualified by its class-name.
  31. For instance the qualified class name of 'f' in the following
  32.  
  33. template<class T> struct list { struct node { T f(); }; };
  34.  
  35. class, is 'list<T> :: node'. Thus it's perfectly reasonable
  36. to define the function 'f' as:
  37.  
  38. template<class T> T list<T> :: node :: f() { return T(); }
  39.  
  40. IMO a complete formal argument can be deduced from the grammar
  41. given in the DWP.
  42. BTW neither gcc2.7.2 nor gcc2.6.3 have any problems with this code.
  43.  
  44.     Enno
  45.